/*
 * @Author: yangzonglong
 * @Date: 2021-03-05 09:55:35
 * @version: v1.0.0
 * @Descripttion: 
 * @LastEditors: yangzonglong
 * @LastEditTime: 2021-05-06 16:00:13
 * @Auditor: 
 */
import React from 'react'
import { Modal } from 'antd'
import ReactJson from 'react-json-view'
import { ControlProps } from './../interface'

interface IProps {
  visible: boolean;
  list: ControlProps[];
  onCancel(): void
}

const bodyStyle = {
  height: '70vh',
  overflowY: 'auto' as any
}

const JsonView = ({ visible, list, onCancel }: IProps) => {
  const src = { list };

  return (
    <Modal bodyStyle={bodyStyle} onCancel={onCancel} onOk={onCancel} visible={visible} width={800} footer={null}>
      <ReactJson collapsed src={src} name='store'/>
    </Modal>
  )
}

export default JsonView;